function logData<T>(data: T) {
  console.log(data);
}
logData<number>(100)
logData<string>('hello')

function logData2<T, U>(data1: T, data2: U): T | U {
  return Date.now() % 2 === 0 ? data1 : data2
}
logData2<number, boolean>(1, false)
logData2<string, number>('hello', 1)


interface PersonInterface<T> {
  name: string,
  extraInfo: T 
}

type JobInfo = {
  title: string,
  year: number
}

let p: PersonInterface<JobInfo> = {
  name: 'Tom',
  extraInfo: {
    title: 'Programmer',
    year: 2015
  }
}

class Person<T> {
  constructor(
    public name: string,
    public extraInfo: T
  ) {}
  speak() {
    console.log(`I'm ${this.name}`)
  }
}

const p1 = new Person<JobInfo>('Tom', {
  title: 'Programmer',
  year: 2015
})

export {}